package com.sweet.system;

/**
 * 系统工具
 *
 * @author limi
 * @date 2024/9/23 16:19
 */
public class OSUtil {
    public static void main(String[] args) {
        //Windows 8.1
        System.out.println(System.getProperties().getProperty("os.name"));
    }

    public static OS current() {
        String sysName = System.getProperties().getProperty("os.name").toUpperCase();
        if (sysName.contains("WINDOWS")) {
            return OS.WINDOWS;
        }
        if (sysName.contains("LINUX")) {
            return OS.LINUX;
        }
        if (sysName.contains("MAC")) {
            return OS.MAC_OS;
        }
        return OS.UNKNOWN;
    }

    public static enum OS {

        WINDOWS,

        LINUX,

        MAC_OS,

        UNKNOWN;
    }
}
